package cn.edu.scau.cmi.lijiongtao.client;

import cn.edu.scau.cmi.lijiongtao.interProgramming.GraduateStudent;
import cn.edu.scau.cmi.lijiongtao.interProgramming.UndergraduateStudent;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;

public class InterProgrammingClient extends Application{
	public static void main(String[] args) {
		launch(args);
	}
	
	@Override
	public void start(Stage stage) throws Exception {
		stage.setTitle("实验一  接口编程");
		stage.setHeight(200);
		stage.setWidth(315);
		
		Button bt1 = new Button("GraduateStudent");
		Button bt2 = new Button("UndergraduateStudent");
		bt1.setMinWidth(150);
		bt2.setMinWidth(150);
		
		HBox hBox = new HBox();
		hBox.getChildren().addAll(bt1,bt2);
		
		Label lb = new Label();
		
		BorderPane bp = new BorderPane();
		bp.setBottom(hBox);
		bp.setCenter(lb);
		
		Scene s = new Scene(bp,480,600);
		
		stage.setScene(s);
		stage.show();
		
		bt1.setOnAction(e -> {
			GraduateStudent student = new GraduateStudent();
			lb.setText(student.learning());
		});
		
		bt2.setOnAction(e -> {
			UndergraduateStudent student = new UndergraduateStudent();
			lb.setText(student.learning());
		});
		
	}

}